package DI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


////使用set方法
//public interface UserService {
//    public void addUser();
//}



//使用注解方法
@Component
public abstract class UserService{
    private UserDao UserDao;

    @Autowired
    public void injectUserDao(UserDao UserDao) { //@1
        System.out.println(this.getClass().getName() + ".injectUserDao()");
        this.UserDao = UserDao;
    }

    @Override
    public String toString() {
        return "UserService{" +
                "UserDao=" + UserDao +
                '}';
    }

    public abstract void addUser();
}


